home *** CD-ROM | disk | FTP | other *** search
- From: Andreas Schwab <schwab@lamothe.informatik.uni-dortmund.de>
- Date: Tue, 23 Nov 93 11:09:50 +0100
- Message-Id: <9311231009.AA01158@lamothe.informatik.uni-dortmund.de>
- To: mint@atari.archive.umich.edu
- Subject: MiNT 1.09: some protection for biosfs
-
- Most of the function of biosfs that change it should only be allowed
- by root, IMHO. This patch adds checks to bios_remove, bios_rename,
- bios_fscntl and bios_symlink. Additionally i have added a check for
- existence of the new name in bios_rename.
-
- --- orig/biosfs.c Tue Aug 17 21:23:18 1993
- +++ biosfs.c Mon Nov 22 19:58:30 1993
- @@ -358,6 +358,9 @@
- struct bios_file *b, **lastb;
-
- UNUSED(dir);
- + if (curproc->euid)
- + return EACCDN;
- +
- lastb = &broot;
- for (b = broot; b; b = *(lastb = &b->next)) {
- if (!stricmp(b->name, name)) break;
- @@ -401,18 +404,24 @@
- fcookie *newdir;
- const char *newname;
- {
- - struct bios_file *b;
- + struct bios_file *b, *be = 0;
-
- UNUSED(olddir); UNUSED(newdir);
-
- -/* BUG: we should check to see if "newname" already exists */
- + if (curproc->euid)
- + return EACCDN;
-
- for (b = broot; b; b = b->next) {
- - if (!stricmp(b->name, oldname)) {
- - strncpy(b->name, newname, BNAME_MAX);
- - return 0;
- - }
- - }
- + if (!stricmp (b->name, newname))
- + return EACCDN;
- + if (!stricmp(b->name, oldname))
- + be = b;
- + }
- + if (be)
- + {
- + strncpy(be->name, newname, BNAME_MAX);
- + return 0;
- + }
- return EFILNF;
- }
-
- @@ -552,6 +561,9 @@
- struct bios_file *b;
-
- UNUSED(dir);
- + if (curproc->euid)
- + return EACCDN;
- +
- if ((unsigned)cmd == DEV_INSTALL) {
- struct dev_descr *d = (struct dev_descr *)arg;
-
- @@ -608,6 +620,9 @@
- struct bios_file *b;
- long r;
- fcookie fc;
- +
- + if (curproc->euid)
- + return EACCDN;
-
- r = bios_lookup(dir, name, &fc);
- if (r == 0) return EACCDN; /* file already exists */
-